-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support js in .hbs files #34
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,9 @@ | |||
yarn lint-staged --allow-empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Добавил линтеры ямл, ts-а и js-а + запустил их на прекоммите
@@ -15,7 +15,7 @@ ui: | |||
|
|||
output: | |||
clean: false | |||
dir: build/site | |||
dir: build/site/en |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
поднастроил тут, чтобы файлики по категории локали всё же были)
import type { Compiler } from 'webpack' | ||
import { spawnCommand } from '../helpers/spawnCommand' | ||
|
||
export class BuildAntoraPlugin { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Добавил плагин, который билдит антору после компиляции сборки и после делает форсированное обновления в браузере
// Compiler's webpack annotations are incompatible in types package:( | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import ZipPlugin from 'zip-webpack-plugin' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не получилось тут подтянуть типы, х его з почему)
@@ -0,0 +1,87 @@ | |||
// eslint-disable-next-line import/default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Разделил файлики на разную конфигурацию. common — общая конфигурация, dev - при разработке, prod - при продакшене
чтобы запустить разные сборки, нужно выполнить команды
npm start - dev
npm run build - prod
import { getDirectoryFileNames } from './helpers' | ||
|
||
const bundleName = 'ui-bundle' | ||
const buildingScripts = getDirectoryFileNames(path.resolve(Env.cwd, './src/scripts')).reduce< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
скрипты положил в отдельную папочку и компилирую их отдельным энтрипоинтом, чтобы потом подключить шаблон (смотри следующий коммент)
fileName: 'partials/body-local-scripts.hbs', | ||
filterKey: 'tagName', | ||
filterValue: 'script', | ||
filterByTagNode: filterInjectingScriptByScriptNames(['highlight.js', 'main.js']), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут настроил темплейт body-local-scripts, который будет содержать в себе указанные в массиве скрипты. сам шаблон работает для каждой страницы
по сути, можно будет создавать partials указывая им нужные скрипты из папки script и инжектить их в любые layouts
const config = merge<WebpackOptionsNormalized | Configuration>(commonConfig, { | ||
mode: 'development', | ||
target: 'web', | ||
devServer: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавил дев сервер с хотрелодом
@@ -0,0 +1,9 @@ | |||
<footer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавил примерчик, чтобы протестить корректонсть работы скрипта:)
@@ -0,0 +1,32 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
затащил ts, но не для обычных скриптов, в целом можно включить его и для них)
No description provided.